/* @(#)DecoratorCanvasLocation.java
** 
** Copyright (C) 2012 by Steven D. Stamps
**
**             Trademarks & Copyrights
** Flywheel Management Science(TM), Flywheel Management Model(TM),
** Flywheel Story Editor(TM) and FlywheelMS(TM) are exclusive trademarks
** of Steven D. Stamps and may only be used freely for the purpose of
** identifying the unforked version of this software.  Subsequent forks
** may not use these trademarks.  All other rights are reserved.
** and FlywheelMS(TM) are exclusive trademarks of Steven D. Stamps
** and may only be used freely for the purpose of identifying the
** unforked version of this software.  Subsequent forks (if any) may
** not use these trademarks.  All other rights are reserved.
**
** DecKanGL (Decorated Kanban Glyph Language) and TribKn (Tribal Knowledge)
** are also exclusive trademarks of Steven D. Stamps.  These may be used
** freely within the unforked FlywheelMS application and documentation.
** All other rights are reserved.
**
** gConGUI (game Controller Graphical User Interface) is an exclusive
** trademark of Steven D. Stamps.  This trademark may be used freely
** within the unforked FlywheelMS application and documentation.
** All other rights are reserved.
**
** Trademark information is available at
** <http://www.flywheelms.com/trademarks>
**
** Flywheel Management Science(TM) is a copyrighted body of management
** metaphors, governance processes, and leadership techniques that is
** owned by Steven D. Stamps.  These copyrighted materials may be freely
** used, without alteration, by the community (users and developers)
** surrounding this GPL3-licensed software.  Additional copyright
** information is available at <http://www.flywheelms.org/copyrights>
**
**              GPL3 Software License
** This program is free software: you can use it, redistribute it and/or
** modify it under the terms of the GNU General Public License, version 3,
** as published by the Free Software Foundation. This program is distributed
** in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
** even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
** PURPOSE.  See the GNU General Public License for more details. You should
** have received a copy of the GNU General Public License, in a file named
** COPYING, along with this program.  If you cannot find your copy, see
** <http://www.gnu.org/licenses/gpl-3.0.html>.
*/

package com.flywheelms.library.deckangl.enumerator;

import java.util.HashMap;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

import com.flywheelms.library.R;
import com.flywheelms.library.deckangl.DecKanGlHelper;
import com.flywheelms.library.deckangl.glyph.CanvasZone;
import com.flywheelms.library.deckangl.glyph.DecKanGlDictionary;
import com.flywheelms.library.deckangl.glyph.DecKanGlGlyph;

public enum DecoratorCanvasLocation {
	
	/* There are 12 possible decorator locations in a DecKanGL Glyph.
	 * Many applications do not utilize all decorator locations.
	 */
	bottom_zone_LEFT(
			R.string.glyph_zone__bottom__left,
			CanvasZone.BOTTOM_ZONE,
			DecKanGlDictionary.getInstance().getWidthBottomEndDecorators(),
			DecKanGlDictionary.getInstance().getHeightBottomZone(),
			new HashMap<DecoratorColor, Integer> (){
				private static final long serialVersionUID = 1L;
				{
					put(DecoratorColor.BLUE, R.drawable.deckangl__decorator__bottom_zone__blue);
					put(DecoratorColor.DISABLED, R.drawable.deckangl__decorator__bottom_zone__disabled);
					put(DecoratorColor.GRAY, R.drawable.deckangl__decorator__bottom_zone__gray);
					put(DecoratorColor.PINK, R.drawable.deckangl__decorator__bottom_zone__pink);
					put(DecoratorColor.ORANGE, R.drawable.deckangl__decorator__bottom_zone__orange);
					put(DecoratorColor.RED, R.drawable.deckangl__decorator__bottom_zone__red);
					put(DecoratorColor.TRANSPARENT, R.drawable.deckangl__decorator__bottom_zone__transparent);
					put(DecoratorColor.YELLOW, R.drawable.deckangl__decorator__bottom_zone__yellow);
				}} ),
	bottom_zone_MIDDLE(
			R.string.glyph_zone__bottom__middle,
			CanvasZone.BOTTOM_ZONE,
			DecKanGlDictionary.getInstance().getWidthBottomMiddleDecorator(),
			DecKanGlDictionary.getInstance().getHeightBottomZone(),
			new HashMap<DecoratorColor, Integer> (){
				private static final long serialVersionUID = 1L;
				{
					put(DecoratorColor.BLUE, R.drawable.deckangl__decorator__bottom_zone__blue);
					put(DecoratorColor.DISABLED, R.drawable.deckangl__decorator__bottom_zone__disabled);
					put(DecoratorColor.GRAY, R.drawable.deckangl__decorator__bottom_zone__gray);
					put(DecoratorColor.PINK, R.drawable.deckangl__decorator__bottom_zone__pink);
					put(DecoratorColor.ORANGE, R.drawable.deckangl__decorator__bottom_zone__orange);
					put(DecoratorColor.RED, R.drawable.deckangl__decorator__bottom_zone__red);
					put(DecoratorColor.TRANSPARENT, R.drawable.deckangl__decorator__bottom_zone__transparent);
					put(DecoratorColor.YELLOW, R.drawable.deckangl__decorator__bottom_zone__yellow);
				}} ),
	bottom_zone_RIGHT(
			R.string.glyph_zone__bottom__right,
			CanvasZone.BOTTOM_ZONE,
			DecKanGlDictionary.getInstance().getWidthBottomEndDecorators(),
			DecKanGlDictionary.getInstance().getHeightBottomZone(),
			new HashMap<DecoratorColor, Integer> (){
				private static final long serialVersionUID = 1L;
				{
					put(DecoratorColor.BLUE, R.drawable.deckangl__decorator__bottom_zone__blue);
					put(DecoratorColor.DISABLED, R.drawable.deckangl__decorator__bottom_zone__disabled);
					put(DecoratorColor.GRAY, R.drawable.deckangl__decorator__bottom_zone__gray);
					put(DecoratorColor.PINK, R.drawable.deckangl__decorator__bottom_zone__pink);
					put(DecoratorColor.ORANGE, R.drawable.deckangl__decorator__bottom_zone__orange);
					put(DecoratorColor.RED, R.drawable.deckangl__decorator__bottom_zone__red);
					put(DecoratorColor.TRANSPARENT, R.drawable.deckangl__decorator__bottom_zone__transparent);
					put(DecoratorColor.YELLOW, R.drawable.deckangl__decorator__bottom_zone__yellow);
				}} ),
	left_zone_BOTTOM(
			R.string.glyph_zone__left__bottom,
			CanvasZone.LEFT_ZONE,
			DecKanGlDictionary.getInstance().getWidthLeftZone(),
			DecKanGlDictionary.getInstance().getHeightLeftCornerDecorators(),
			new HashMap<DecoratorColor, Integer> (){
				private static final long serialVersionUID = 1L;
				{
					put(DecoratorColor.BLUE, R.drawable.deckangl__decorator__left_zone_corner__blue);
					put(DecoratorColor.DISABLED, R.drawable.deckangl__decorator__left_zone_corner__disabled);
					put(DecoratorColor.GRAY, R.drawable.deckangl__decorator__left_zone_corner__gray);
					put(DecoratorColor.PINK, R.drawable.deckangl__decorator__left_zone_corner__pink);
					put(DecoratorColor.ORANGE, R.drawable.deckangl__decorator__left_zone_corner__orange);
					put(DecoratorColor.RED, R.drawable.deckangl__decorator__left_zone_corner__red);
					put(DecoratorColor.TRANSPARENT, R.drawable.deckangl__decorator__left_zone_corner__transparent);
					put(DecoratorColor.YELLOW, R.drawable.deckangl__decorator__left_zone_corner__yellow);
				}} ),
	left_zone_MIDDLE(
			R.string.glyph_zone__left__middle,
			CanvasZone.LEFT_ZONE,
			DecKanGlDictionary.getInstance().getWidthLeftZone(),
			DecKanGlDictionary.getInstance().getHeightLeftMiddleDecorators(),
			new HashMap<DecoratorColor, Integer> (){
				private static final long serialVersionUID = 1L;
				{
					put(DecoratorColor.BLUE, R.drawable.deckangl__decorator__left_zone_middle__blue);
					put(DecoratorColor.DISABLED, R.drawable.deckangl__decorator__left_zone_middle__disabled);
					put(DecoratorColor.GRAY, R.drawable.deckangl__decorator__left_zone_middle__gray);
					put(DecoratorColor.PINK, R.drawable.deckangl__decorator__left_zone_middle__pink);
					put(DecoratorColor.ORANGE, R.drawable.deckangl__decorator__left_zone_middle__orange);
					put(DecoratorColor.RED, R.drawable.deckangl__decorator__left_zone_middle__red);
					put(DecoratorColor.TRANSPARENT, R.drawable.deckangl__decorator__left_zone_middle__transparent);
					put(DecoratorColor.YELLOW, R.drawable.deckangl__decorator__left_zone_middle__yellow);
				}} ),
	left_zone_TOP(
			R.string.glyph_zone__left__top,
			CanvasZone.LEFT_ZONE,
			DecKanGlDictionary.getInstance().getWidthLeftZone(),
			DecKanGlDictionary.getInstance().getHeightLeftCornerDecorators(),
			new HashMap<DecoratorColor, Integer> (){
				private static final long serialVersionUID = 1L;
				{
					put(DecoratorColor.BLUE, R.drawable.deckangl__decorator__left_zone_corner__blue);
					put(DecoratorColor.DISABLED, R.drawable.deckangl__decorator__left_zone_corner__disabled);
					put(DecoratorColor.GRAY, R.drawable.deckangl__decorator__left_zone_corner__gray);
					put(DecoratorColor.PINK, R.drawable.deckangl__decorator__left_zone_corner__pink);
					put(DecoratorColor.ORANGE, R.drawable.deckangl__decorator__left_zone_corner__orange);
					put(DecoratorColor.RED, R.drawable.deckangl__decorator__left_zone_corner__red);
					put(DecoratorColor.TRANSPARENT, R.drawable.deckangl__decorator__left_zone_corner__transparent);
					put(DecoratorColor.YELLOW, R.drawable.deckangl__decorator__left_zone_corner__yellow);
				}} ),
	right_zone_BOTTOM(
			R.string.glyph_zone__right__bottom,
			CanvasZone.RIGHT_ZONE,
			DecKanGlDictionary.getInstance().getWidthRightZone(),
			DecKanGlDictionary.getInstance().getHeightRightCornerDecorators(),
			new HashMap<DecoratorColor, Integer> (){
				private static final long serialVersionUID = 1L;
				{
					put(DecoratorColor.BLUE, R.drawable.deckangl__decorator__right_zone_corner__blue);
					put(DecoratorColor.DISABLED, R.drawable.deckangl__decorator__right_zone_corner__disabled);
					put(DecoratorColor.GRAY, R.drawable.deckangl__decorator__right_zone_corner__gray);
					put(DecoratorColor.PINK, R.drawable.deckangl__decorator__right_zone_corner__pink);
					put(DecoratorColor.ORANGE, R.drawable.deckangl__decorator__right_zone_corner__orange);
					put(DecoratorColor.RED, R.drawable.deckangl__decorator__right_zone_corner__red);
					put(DecoratorColor.TRANSPARENT, R.drawable.deckangl__decorator__right_zone_corner__transparent);
					put(DecoratorColor.YELLOW, R.drawable.deckangl__decorator__right_zone_corner__yellow);
				}} ),
	right_zone_MIDDLE(
			R.string.glyph_zone__right__middle,
			CanvasZone.RIGHT_ZONE,
			DecKanGlDictionary.getInstance().getWidthRightZone(),
			DecKanGlDictionary.getInstance().getHeightRightMiddleDecorators(),
			new HashMap<DecoratorColor, Integer> (){
				private static final long serialVersionUID = 1L;
				{
					put(DecoratorColor.BLUE, R.drawable.deckangl__decorator__right_zone_middle__blue);
					put(DecoratorColor.DISABLED, R.drawable.deckangl__decorator__right_zone_middle__disabled);
					put(DecoratorColor.GRAY, R.drawable.deckangl__decorator__right_zone_middle__gray);
					put(DecoratorColor.PINK, R.drawable.deckangl__decorator__right_zone_middle__pink);
					put(DecoratorColor.ORANGE, R.drawable.deckangl__decorator__right_zone_middle__orange);
					put(DecoratorColor.RED, R.drawable.deckangl__decorator__right_zone_middle__red);
					put(DecoratorColor.TRANSPARENT, R.drawable.deckangl__decorator__right_zone_middle__transparent);
					put(DecoratorColor.YELLOW, R.drawable.deckangl__decorator__right_zone_middle__yellow);
				}} ),
	right_zone_TOP(
			R.string.glyph_zone__right__top,
			CanvasZone.RIGHT_ZONE,
			DecKanGlDictionary.getInstance().getWidthRightZone(),
			DecKanGlDictionary.getInstance().getHeightRightCornerDecorators(),
			new HashMap<DecoratorColor, Integer> (){
				private static final long serialVersionUID = 1L;
				{
					put(DecoratorColor.BLUE, R.drawable.deckangl__decorator__right_zone_corner__blue);
					put(DecoratorColor.DISABLED, R.drawable.deckangl__decorator__right_zone_corner__disabled);
					put(DecoratorColor.GRAY, R.drawable.deckangl__decorator__right_zone_corner__gray);
					put(DecoratorColor.PINK, R.drawable.deckangl__decorator__right_zone_corner__pink);
					put(DecoratorColor.ORANGE, R.drawable.deckangl__decorator__right_zone_corner__orange);
					put(DecoratorColor.RED, R.drawable.deckangl__decorator__right_zone_corner__red);
					put(DecoratorColor.TRANSPARENT, R.drawable.deckangl__decorator__right_zone_corner__transparent);
					put(DecoratorColor.YELLOW, R.drawable.deckangl__decorator__right_zone_corner__yellow);
				}} ),
	top_zone_LEFT(
			R.string.glyph_zone__top__left,
			CanvasZone.TOP_ZONE,
			DecKanGlDictionary.getInstance().getWidthTopEndDecorators(),
			DecKanGlDictionary.getInstance().getHeightTopZone(),
			new HashMap<DecoratorColor, Integer> (){
				private static final long serialVersionUID = 1L;
				{
					put(DecoratorColor.BLUE, R.drawable.deckangl__decorator__top_zone_ends__blue);
					put(DecoratorColor.DISABLED, R.drawable.deckangl__decorator__top_zone_ends__disabled);
					put(DecoratorColor.GRAY, R.drawable.deckangl__decorator__top_zone_ends__gray);
					put(DecoratorColor.PINK, R.drawable.deckangl__decorator__top_zone_ends__pink);
					put(DecoratorColor.ORANGE, R.drawable.deckangl__decorator__top_zone_ends__orange);
					put(DecoratorColor.RED, R.drawable.deckangl__decorator__top_zone_ends__red);
					put(DecoratorColor.TRANSPARENT, R.drawable.deckangl__decorator__top_zone_ends__transparent);
					put(DecoratorColor.YELLOW, R.drawable.deckangl__decorator__top_zone_ends__yellow);
				}} ),
	top_zone_MIDDLE(
			R.string.glyph_zone__top__middle,
			CanvasZone.TOP_ZONE,
			DecKanGlDictionary.getInstance().getWidthTopMiddleDecorator(),
			DecKanGlDictionary.getInstance().getHeightTopZone(),
			new HashMap<DecoratorColor, Integer> (){
				private static final long serialVersionUID = 1L;
				{
					put(DecoratorColor.BLUE, R.drawable.deckangl__decorator__top_zone_middle__blue);
					put(DecoratorColor.DISABLED, R.drawable.deckangl__decorator__top_zone_middle__disabled);
					put(DecoratorColor.GRAY, R.drawable.deckangl__decorator__top_zone_middle__gray);
					put(DecoratorColor.PINK, R.drawable.deckangl__decorator__top_zone_middle__pink);
					put(DecoratorColor.ORANGE, R.drawable.deckangl__decorator__top_zone_middle__orange);
					put(DecoratorColor.RED, R.drawable.deckangl__decorator__top_zone_middle__red);
					put(DecoratorColor.TRANSPARENT, R.drawable.deckangl__decorator__top_zone_middle__transparent);
					put(DecoratorColor.YELLOW, R.drawable.deckangl__decorator__top_zone_middle__yellow);
				}} ),
	top_zone_RIGHT(
			R.string.glyph_zone__top__right,
			CanvasZone.TOP_ZONE,
			DecKanGlDictionary.getInstance().getWidthTopEndDecorators(),
			DecKanGlDictionary.getInstance().getHeightTopZone(),
			new HashMap<DecoratorColor, Integer> (){
				private static final long serialVersionUID = 1L;
				{
					put(DecoratorColor.BLUE, R.drawable.deckangl__decorator__top_zone_ends__blue);
					put(DecoratorColor.DISABLED, R.drawable.deckangl__decorator__top_zone_ends__disabled);
					put(DecoratorColor.GRAY, R.drawable.deckangl__decorator__top_zone_ends__gray);
					put(DecoratorColor.ORANGE, R.drawable.deckangl__decorator__top_zone_ends__orange);
					put(DecoratorColor.PINK, R.drawable.deckangl__decorator__top_zone_ends__pink);
					put(DecoratorColor.RED, R.drawable.deckangl__decorator__top_zone_ends__red);
					put(DecoratorColor.TRANSPARENT, R.drawable.deckangl__decorator__top_zone_ends__transparent);
					put(DecoratorColor.YELLOW, R.drawable.deckangl__decorator__top_zone_ends__yellow);
				}} );
	
	private static HashMap<String, DecoratorCanvasLocation> nameMap = new HashMap<String, DecoratorCanvasLocation>();
	static {
		DecoratorCanvasLocation.nameMap.put(bottom_zone_LEFT.getName(), bottom_zone_LEFT);
		DecoratorCanvasLocation.nameMap.put(bottom_zone_MIDDLE.getName(), bottom_zone_MIDDLE);
		DecoratorCanvasLocation.nameMap.put(bottom_zone_RIGHT.getName(), bottom_zone_RIGHT);
		DecoratorCanvasLocation.nameMap.put(left_zone_BOTTOM.getName(), left_zone_BOTTOM);
		DecoratorCanvasLocation.nameMap.put(left_zone_MIDDLE.getName(), left_zone_MIDDLE);
		DecoratorCanvasLocation.nameMap.put(left_zone_TOP.getName(), left_zone_TOP);
		DecoratorCanvasLocation.nameMap.put(right_zone_BOTTOM.getName(), right_zone_BOTTOM);
		DecoratorCanvasLocation.nameMap.put(right_zone_MIDDLE.getName(), right_zone_MIDDLE);
		DecoratorCanvasLocation.nameMap.put(right_zone_TOP.getName(), right_zone_TOP);
		DecoratorCanvasLocation.nameMap.put(top_zone_LEFT.getName(), top_zone_LEFT);
		DecoratorCanvasLocation.nameMap.put(top_zone_MIDDLE.getName(), top_zone_MIDDLE);
		DecoratorCanvasLocation.nameMap.put(top_zone_RIGHT.getName(), top_zone_RIGHT);
	}

	public static DecoratorCanvasLocation getObjectForName(String aName) {
		return DecoratorCanvasLocation.nameMap.get(aName);
	}

	private final int nameResourceId;
	private String name = null;
	private final CanvasZone decKanGlDecoratorCanvasZone;
	private final transient HashMap<DecoratorColor, Bitmap> bitmapMap = new HashMap<DecoratorColor, Bitmap>();
	private final int decoratorWidth;
	private final int decoratorHeight;
	private final HashMap<DecoratorColor, Integer> resourceIdMap;
	
	private DecoratorCanvasLocation(
			int aNameResourceId,
			CanvasZone aDecKanGlDecoratorCanvasZone,
			int aDecoratorWidth,
			int aDecoratorHeight,
			HashMap<DecoratorColor, Integer> aResourceIdMap ) {
//			Integer[] aBitmapResourceIdArray ) {
		this.nameResourceId = aNameResourceId;
		this.decKanGlDecoratorCanvasZone = aDecKanGlDecoratorCanvasZone;
		this.resourceIdMap = aResourceIdMap;
		this.decoratorWidth = aDecoratorWidth;
		this.decoratorHeight = aDecoratorHeight;
	}
	
	private void initializeBitmapMap(HashMap<DecoratorColor, Integer> aResourceIdMap) {
		for(DecoratorColor theDecoratorColor : DecoratorColor.values()) {
			if(aResourceIdMap.get(theDecoratorColor) != null) {
				BitmapFactory.Options theBitmapOptions = new BitmapFactory.Options();
				theBitmapOptions.inScaled = false;
				this.bitmapMap.put(
						theDecoratorColor,
						BitmapFactory.decodeResource(
								DecKanGlHelper.getResources(),
								aResourceIdMap.get(theDecoratorColor),
								theBitmapOptions) );
			}
		}
	}

	@Override
	public String toString() {
		return getName();
	}

	public String getName() {
		if(this.name == null && this.nameResourceId != 0)  {
			this.name = DecKanGlHelper.getResources().getString(this.nameResourceId);
		}
		return this.name;
	}
	
	public CanvasZone getGlyphCanvasZone() {
		return this.decKanGlDecoratorCanvasZone;
	}
	
	public Bitmap getBitmapForColor(DecoratorColor aDecoratorColor) {
		if(this.bitmapMap.size() < 1) {
			initializeBitmapMap(this.resourceIdMap);
		}
		return this.bitmapMap.get(aDecoratorColor);
	}

	public HashMap<DecoratorColor, Bitmap> getBitmapMap() {
		return this.bitmapMap;
	}

	public int getDecoratorWidth() {
		return this.decoratorWidth;
	}

	public int getDecoratorHeight() {
		return this.decoratorHeight;
	}

	public int getCanvasPositionX(DecKanGlGlyph aDecKanGlGlyph) {
		if (this.getGlyphCanvasZone() == CanvasZone.LEFT_ZONE) {
			return aDecKanGlGlyph.getGlyphCanvas().getMarginLeft();
		}
		if (this.getGlyphCanvasZone() == CanvasZone.RIGHT_ZONE) {
			return aDecKanGlGlyph.getGlyphCanvas().getWidth() -
					aDecKanGlGlyph.getGlyphCanvas().getMarginRight() -
					CanvasZone.RIGHT_ZONE.getWidth() - 1;  // TODO - HACK ALERT !!!   SDS
		}
		if (this == bottom_zone_LEFT) {
			return (aDecKanGlGlyph.getGlyphCanvas().getWidth() / 2) -
					(bottom_zone_LEFT.getDecoratorWidth() + (bottom_zone_MIDDLE.getDecoratorWidth() / 2));
		}
		if (this == bottom_zone_MIDDLE) {
			return (aDecKanGlGlyph.getGlyphCanvas().getWidth() / 2) -
					(bottom_zone_MIDDLE.getDecoratorWidth() / 2);
		}
		if (this == bottom_zone_RIGHT) {
			return ((aDecKanGlGlyph.getGlyphCanvas().getWidth() / 2) - 1) +
					(bottom_zone_MIDDLE.getDecoratorWidth() - (bottom_zone_MIDDLE.getDecoratorWidth() / 2) - 1);
		}
		if (this == top_zone_LEFT) {
			return (aDecKanGlGlyph.getGlyphCanvas().getWidth() / 2) -
					(top_zone_LEFT.getDecoratorWidth() + (top_zone_MIDDLE.getDecoratorWidth() / 2));
		}
		if (this == top_zone_MIDDLE) {
			return (aDecKanGlGlyph.getGlyphCanvas().getWidth() / 2) -
					(top_zone_MIDDLE.getDecoratorWidth() / 2) - 1;
		}
		if (this == top_zone_RIGHT) {
			return ((aDecKanGlGlyph.getGlyphCanvas().getWidth() / 2) - 1) +
					(top_zone_MIDDLE.getDecoratorWidth() - (top_zone_MIDDLE.getDecoratorWidth() / 2) - 1);
		}
		return 0;
	}

	public int getCanvasPositionY(DecKanGlGlyph aDecKanGlGlyph) {
		if (this.getGlyphCanvasZone() == CanvasZone.BOTTOM_ZONE) {
			return aDecKanGlGlyph.getGlyphCanvas().getHeight() -
					aDecKanGlGlyph.getGlyphCanvas().getMarginBottom() -
					CanvasZone.BOTTOM_ZONE.getHeight() - 1;  // TODO - HACK ALERT !!!   SDS 
		}
		if (this.getGlyphCanvasZone() == CanvasZone.TOP_ZONE) {
			return aDecKanGlGlyph.getGlyphCanvas().getMarginTop();
		}
		if (this == left_zone_BOTTOM) {
			return aDecKanGlGlyph.getGlyphCanvas().getMarginTop() +
					CanvasZone.TOP_ZONE.getHeight() +
					DecoratorCanvasLocation.left_zone_TOP.getDecoratorHeight() +
					DecoratorCanvasLocation.left_zone_MIDDLE.getDecoratorHeight() - 2;
		}
		if (this == left_zone_MIDDLE) {
			return aDecKanGlGlyph.getGlyphCanvas().getMarginTop() +
					CanvasZone.TOP_ZONE.getHeight() +
					DecoratorCanvasLocation.left_zone_TOP.getDecoratorHeight() - 1;
		}
		if (this == left_zone_TOP) {
			return aDecKanGlGlyph.getGlyphCanvas().getMarginTop() +
					CanvasZone.TOP_ZONE.getHeight();
		}
		if (this == right_zone_BOTTOM) {
			return aDecKanGlGlyph.getGlyphCanvas().getMarginTop() +
					CanvasZone.TOP_ZONE.getHeight() +
					DecoratorCanvasLocation.left_zone_TOP.getDecoratorHeight() +
					DecoratorCanvasLocation.left_zone_MIDDLE.getDecoratorHeight() - 2;
		}
		if (this == right_zone_MIDDLE) {
			return aDecKanGlGlyph.getGlyphCanvas().getMarginTop() +
					CanvasZone.TOP_ZONE.getHeight() +
					DecoratorCanvasLocation.left_zone_TOP.getDecoratorHeight() - 1;
		}
		if (this == right_zone_TOP) {
			return aDecKanGlGlyph.getGlyphCanvas().getMarginTop() +
					CanvasZone.TOP_ZONE.getHeight();
		}
		return 0;
	}
	
}